home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
doors_1
/
hof100.zip
/
SOURCE.ZIP
/
HOF.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1992-02-24
|
3KB
|
142 lines
PROGRAM HallOfFame;
USES DOS,BigStrng;
CONST
MaxNames = 6;
Blanks = ' ';
TYPE
String17 = STRING[17];
String2 = STRING[2];
VAR
PlayerName,PlayerDate : ARRAY [1..6] OF String17;
f : TEXT;
i : INTEGER;
PROCEDURE GetOldNames;
BEGIN
ASSIGN(f,'HOF.DAT');
{$I-} RESET(f); {$I+}
IF IORESULT=0 THEN BEGIN
FOR i:=1 TO MaxNames DO BEGIN
READLN(f,PlayerName[i]);
PlayerName[i]:=PlayerName[i]+Blanks;
READLN(f,PlayerDate[i]);
PlayerDate[i]:=PlayerDate[i]+Blanks;
END;
Close(f);
END ELSE BEGIN
ASSIGN(f,'HOF.DAT');
REWRITE(f);
FOR i:=1 TO MaxNames DO BEGIN
PlayerName[i]:=Blanks;
PlayerDate[i]:=Blanks;
WRITELN(f,PlayerName[i]);
WRITELN(f,PlayerDate[i]);
END;
CLOSE(f);
END;
END;
FUNCTION lz(i:INTEGER) : String2;
VAR
s : String2;
BEGIN
STR(i:2,s);
IF i<10 THEN s[1]:='0';
lz:=s;
END;
PROCEDURE GetNewName(VAR name,date : String17);
VAR
tm : LONGINT;
dt : DateTime;
BEGIN
ASSIGN(f,'WINNERS.TOP');
{$I-} RESET(f); {$I+}
IF IORESULT=0 THEN BEGIN
READLN(f,i);
READLN(f,name);
name:=name+Blanks;
GETFTIME(f,tm);
UNPACKTIME(tm,dt);
WITH dt DO
date:=lz(month)+'/'+lz(day)+'/'+lz(year-1900)+' '+lz(hour)+':'+lz(min)+Blanks;
CLOSE(f);
END ELSE BEGIN
Writeln('WINNERS.TOP not found!');
Halt(1);
END;
END;
PROCEDURE SaveNewNames;
BEGIN
ASSIGN(f,'HOF.DAT');
REWRITE(f);
FOR i:=1 TO MaxNames DO BEGIN
WRITELN(f,PlayerName[i]);
WRITELN(f,PlayerDate[i]);
END;
CLOSE(f);
END;
PROCEDURE UpdateBulletin;
VAR
bs,bs1 : BigString;
ch : CHAR;
PROCEDURE Rep(old,new:String17);
BEGIN
SetBigString(bs1,old);
i:=BigPos(bs1,bs);
BigDelete(bs,i,17);
SetBigString(bs1,new);
BigInsert(bs1,bs,i);
END;
BEGIN
ASSIGN(f,'HOF.ANS');
{$I-} RESET(f); {$I+}
IF IORESULT<>0 THEN BEGIN
WRITELN('HOF.ANS not found!');
HALT(1);
END;
bs.length:=0;
WHILE NOT EOF(f) DO BEGIN
READ(f,ch);
INC(bs.length);
bs.ch[bs.length]:=ch;
END;
CLOSE(f);
Rep('11111111111111111',PlayerName[1]);
Rep('22222222222222222',PlayerName[2]);
Rep('33333333333333333',PlayerName[3]);
Rep('44444444444444444',PlayerName[4]);
Rep('55555555555555555',PlayerName[5]);
Rep('66666666666666666',PlayerName[6]);
Rep('AAAAAAAAAAAAAAAAA',PlayerDate[1]);
Rep('BBBBBBBBBBBBBBBBB',PlayerDate[2]);
Rep('CCCCCCCCCCCCCCCCC',PlayerDate[3]);
Rep('DDDDDDDDDDDDDDDDD',PlayerDate[4]);
Rep('EEEEEEEEEEEEEEEEE',PlayerDate[5]);
Rep('FFFFFFFFFFFFFFFFF',PlayerDate[6]);
ASSIGN(f,'BULLETIN.ANS');
REWRITE(f);
FOR i:=1 TO bs.length DO
WRITE(f,bs.ch[i]);
CLOSE(f);
END;
BEGIN
Writeln('Hall Of Fame utility for Global War 2.40+ by Joel Bergen. Version 1.0');
GetOldNames;
FOR i:= MaxNames DOWNTO 2 DO BEGIN
PlayerName[i]:=PlayerName[i-1];
PlayerDate[i]:=PlayerDate[i-1];
END;
GetNewName(PlayerName[1],PlayerDate[1]);
SaveNewNames;
UpdateBulletin;
END.